import {
	getShareImage
} from "@/api/chatDpt.js"
export default {
	data() {
		return {
			imgUrl: '',
			titleName: ''
		}
	},
	onLoad: async function() {
		const res = await getShareImage();
		this.imgUrl = res[0].image_url;
		this.titleName = res[0].title;
		wx.showShareMenu({
			withShareTicket: true,
			menus: ["shareAppMessage", "shareTimeline"]
		})

	},
	onShareAppMessage(res) {
		// let that = this;
		// let imageUrl = that.shareUrl || '';
		// if (res.from === 'button') {
		// //这块需要传参，不然链接地址进去获取不到数据
		// 	let path = `/` + that.$scope.route + `?item=` + that.$scope.options.item;
		// 	return {
		// 		title: '商品分享~',
		// 		path: path,
		// 		imageUrl: imageUrl
		// 	};
		// }
		// if (res.from === 'menu') {
		// 	return {
		// 		title: '商通线上商城',
		// 		path: '/pages/tabBarPro/index/index',
		// 		imageUrl: imageUrl
		// 	};
		// }
		return {
			title: this.titleName,
			path: '/pages/index/index',
			imageUrl: this.imgUrl
		};
	},
	// 分享到朋友圈
	onShareTimeline() {
		return {
			title: this.titleName,
			path: '/pages/index/index',
			imageUrl: this.imgUrl
		};
	},
	methods: {

	}
}
